<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script charset="utf-8" src="scripts/vendor/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="scripts/vendor/kindeditor/lang/zh_CN.js"></script>
<script>
var editor;
KindEditor.ready(function(K) {
        editor = K.create('#ttContent', {
        	uploadJson : 'file/file-upload.action',
        	fileManagerJson : 'file/file-manager.action',
        	allowFileManager : true
        });
});
function save(){
	if( editor.isEmpty() ){
		if(0 == $('#emptyAlert').length){
			$('#draft').after(warn());
		}
	}else{
		editor.sync();
		$('#comFill').trigger('submit');
	}
}

function warn(){
	return '<div id="emptyAlert" class="alert" style="width:200px;float:none;"><a class="close" data-dismiss="alert">×</a>'
			+' <strong>Warning!</strong> 内容不能为空</div>';
}
</script>
<title>布置作业</title>
</head>
<body>
<div class="alert alert-info" >
<s:property value="tt.course.name"/> 在<s:date name="tt.teachDate" format="yyyy-MM-dd" /> 的作业
</div>

<div class="clearfix">
<form id="comFill" method="post" action="course/commit-homework-assignment.action">
		<input  name="tid" value="<s:property value='tt.id'/>" type="hidden"/>
		<input  name="ha.id" value="<s:property value='ha.id'/>" type="hidden"/>
		<input  name="ha.version" value="<s:property value='ha.version'/>" type="hidden"/>
		<textarea id="ttContent" name="ha.content" style="width:100%;height:300px;"><s:property value='ha.content'/></textarea>   
		<div>
		<input id="artWork" class="btn" onclick="save()" type="button" value="提交" />
		<a href="course/teachings.action?tid=<s:property value='tt.id'/>" >返回</a>
		</div>
</form>
</div>
</body>
</html>